<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<link rel="Bookmark" href="imgs/favicon.ico"/>
	<link rel="Shortcut Icon" href="imgs/favicon.ico"/>
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
	<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
	<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
	<title>商城</title>
	<style type="text/css">
		#load { margin-left: 20px; font-weight: normal; color: #888; }
		.hr { margin: 20px 5%; width: 90%; height: 1px; background: #EEEEEE; }
		.title { margin-left: 10px; padding: 0; padding-left: 10px; border-left: 5px solid #0088CC; font-weight: bolder; }
		#skuGroup { margin: 20px auto; width: 90%; }
		#skuGroup .skuOne { margin: 20px auto; padding-bottom: 20px; width: 90%;border: 1px solid #EEEEEE;  background: #f9f9f9; }
		#skuForm { margin: 20px auto; padding-bottom: 20px; width: 81%; border: 1px solid #EEEEEE; background: #f9f9f9; }
	</style>
</head>
<body>
<div class="page-container">
	<form class="form form-horizontal" id="form-article-add">
		<div class="row cl title">
			基本信息
			<span id="load">(稍等几秒，加载中...)</span>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span> 商品名称：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" id="title" onblur="formData.title=this.value;"/>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span> 商品分类：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select class="select" id="cateid" onchange="formData.cateid=this.value;">
					<option value="0">全部栏目</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span> 商品主图：
			</label>
			<div class="formControls col-xs-8 col-sm-9" id="bigOut">
				<div style="padding: 5px 0; width: 100px; background: #0088cc; text-align: center; font-size: 12px; color: #fff; border-radius: 5px; position: relative;">上传图片</div>
				<input type="file" id="bigUpload" style="width: 150px; height: 30px; opacity: 0; cursor: pointer; position: relative; top: -25px; left: -20px;" onchange="uploadImage(1)"/>
				<div id="bigShow" style="margin-top: -20px; width: 500px; height: 300px; background: #eee; overflow: hidden;"></div>
			</div>
		</div>
		<!--<div class="row cl">-->
			<!--<label class="form-label col-xs-4 col-sm-2">-->
				<!--销量：-->
			<!--</label>-->
			<!--<div class="formControls col-xs-8 col-sm-9">-->
				<!--<input type="text" class="input-text" id="sale"/>-->
			<!--</div>-->
		<!--</div>-->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<span class="c-red">*</span> 详情多图：
				<br/>（最多5张）
				<br/><span id="moreTotal">（当前0张）</span>
			</label>
			<div class="formControls col-xs-8 col-sm-9" id="moreOut">
				<div style="padding: 5px 0; width: 100px; background: #0088cc; text-align: center; font-size: 12px; color: #fff; border-radius: 5px; position: relative;">上传图片</div>
				<input type="file" id="moreUpload" style="width: 150px; height: 30px; opacity: 0; cursor: pointer; position: relative; top: -25px; left: -20px;" onchange="uploadMore();"/>
				<div id="moreShow" style="margin-top: -20px; width: 500px; height: 300px; background: #eee; overflow-x: hidden; overflow-y: auto"></div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				详情内容：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<!-- 加载编辑器的容器 -->
				<script type="text/javascript" charset="utf-8" src="../ueditor/ueditor.config.js"></script>
				<script type="text/javascript" charset="utf-8" src="../ueditor/ueditor.parse.js"></script>
				<script type="text/javascript" charset="utf-8" src="../ueditor/editor_api.js"></script>
				<script type="text/javascript" charset="utf-8" src="../ueditor/lang/zh-cn/zh-cn.js"></script>
				<script type="text/plain" id="myEditor" style="width: 100%; height: 300px;">
				</script>
				<script type="text/javascript">
					//初始化百度编辑器
					var ue = UE.getEditor('myEditor',{
						toolbars: [ [
							'bold', //加粗
							'indent', //首行缩进
							'italic', //斜体
							'underline', //下划线
							'strikethrough', //删除线
							'subscript', //下标
							'fontborder', //字符边框
							'superscript', //上标
							'formatmatch', //格式刷
							'horizontal', //分隔线
							'removeformat', //清除格式
							'time', //时间
							'date', //日期
							//'insertcode', //代码语言
							'fontfamily', //字体
							'fontsize', //字号
							'paragraph', //段落格式
							'edittable', //表格属性
							'link', //超链接
							'justifyleft', //居左对齐
							'justifyright', //居右对齐
							'justifycenter', //居中对齐
							'justifyjustify', //两端对齐
							'forecolor', //字体颜色
							'backcolor', //背景色
							'insertorderedlist', //有序列表
							'insertunorderedlist', //无序列表
							'fullscreen', //全屏
							'directionalityltr', //从左向右输入
							'directionalityrtl', //从右向左输入
							'rowspacingtop', //段前距
							'rowspacingbottom', //段后距
							'pagebreak', //分页
							'insertframe', //插入Iframe
							'attachment', //附件
							'edittip ', //编辑提示
							'touppercase', //字母大写
							'tolowercase', //字母小写
							'background', //背景
							"|",
							"simpleupload",
							"insertimage",
						] ],
						//focus时自动清空初始化时的内容
						autoClearinitialContent: true,
						//关闭字数统计
						wordCount: true,
						//关闭elementPath
						elementPathEnabled: false,
						//默认的编辑区域高度
						ninitialFrameHeight: 300,
						//更多其他参数，请参考ueditor.config.js中的配置项
						autoHeightEnabled: false, //固定高度
					});
				</script>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				是否上新：
			</label>
			<div class="formControls col-xs-8 col-sm-9" id="newOut">
				<div class="radio-box" onclick="formData.isnew=0;">
					<input name="isnew" type="radio" id="sex-1" value="0" checked/>
					<label for="sex-1">否</label>
				</div>
				<div class="radio-box" onclick="formData.isnew=1;">
					<input name="isnew" type="radio" id="sex-2" value="0"/>
					<label for="sex-2">是</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<!--<span class="c-red">*</span>-->
				限时折扣率：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" id="cheap_per" placeholder="如75，代表七五折，不填默认100"/>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<!--<span class="c-red">*</span>-->
				折扣开始时间：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text Wdate" id="cheap_start_time"
					   onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'cheap_end_time\')||\'%y-%M-%d %h:%i:$s\'}'})"/>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">
				<!--<span class="c-red">*</span>-->
				折扣结束时间：
			</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text Wdate" id="cheap_end_time"
					   onfocus="WdatePicker({minDate:'#F{$dp.$D(\'cheap_start_time\')||\'%y-%M-%d %h:%i:$s\'}'})"/>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button class="btn btn-primary radius" type="button" onclick="gSave();">
					<i class="Hui-iconfont">&#xe632;</i> 保存商品
				</button>
			</div>
		</div>
		<br/><br/>
		<div class="hr"></div>
		<div class="row cl title">
			SKU规格信息
			<!--<span style="color: #888; font-size: 14px; font-weight: normal;">（添加商品后再设置）</span>-->
		</div>
		<div id="skuGroup">
			<!--<div class="skuOne">-->
				<!--<div class="row cl">-->
					<!--<label class="form-label col-xs-4 col-sm-2">规格名称：</label>-->
					<!--<div class="formControls col-xs-8 col-sm-9">-->
						<!--<input type="text" class="input-text" value="" disabled/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="row cl">-->
					<!--<label class="form-label col-xs-4 col-sm-2">单价(元)：</label>-->
					<!--<div class="formControls col-xs-8 col-sm-9">-->
						<!--<input type="text" class="input-text" value="0" disabled/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="row cl">-->
					<!--<label class="form-label col-xs-4 col-sm-2">划线价(元)：-->
					<!--</label>-->
					<!--<div class="formControls col-xs-8 col-sm-9">-->
						<!--<input type="text" class="input-text" value="0" disabled/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="row cl">-->
					<!--<label class="form-label col-xs-4 col-sm-2">库存量：</label>-->
					<!--<div class="formControls col-xs-8 col-sm-9">-->
						<!--<input type="text" class="input-text" value="0" disabled/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="row cl">-->
					<!--<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">-->
						<!--<button class="btn btn-primary radius" type="button" style="background: red; border: 0;" onclick="">-->
							<!--删除该SKU-->
						<!--</button>-->
					<!--</div>-->
				<!--</div>-->
			<!--</div>-->
		</div>
		<div id="skuForm">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">
					<span class="c-red">*</span> 规格名称：
				</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="text" class="input-text" value="" id="sku_title"/>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">
					<span class="c-red">*</span> 单价(元)：
				</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="number" class="input-text" value="" id="sku_price" style="width: 100%;"/>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">
					<span class="c-red">*</span> 划线价(元)：
				</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="number" class="input-text" value="" id="sku_price_line" style="width: 100%;"/>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">
					<!--<span class="c-red">*</span> -->
					库存量：
				</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="number" class="input-text" value="" id="sku_stock" style="width: 100%;"/>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-2">
					<!--<span class="c-red">*</span> -->
					分佣比率：
				</label>
				<div class="formControls col-xs-8 col-sm-9">
					<input type="number" class="input-text" value="" id="sku_rate" style="width: 100%;"/>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button class="btn btn-primary radius" type="button" onclick="skuAdd();">
						<i class="Hui-iconfont">&#xe632;</i> 添加SKU
					</button>
					<button class="btn btn-primary radius" type="button" style="background: red; border: 0;" onclick="skuInit();">
						清除
					</button>
				</div>
			</div>
		</div>
		<br/><br/>
	</form>
</div>

<!--自定义弹窗-->
<span id="msgPop"></span>
</body>
</html>


<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.page.js"></script>
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/view.js"></script>
<script type="text/javascript" src="js/goods-edit.js?t="></script>
<script type="text/javascript">
	var id = getParamByUrl('id');
	var formData = {
		title: '',
		cateid: 0,
		bigImg: '',
		isnew: 0,
	};
	var moreImgs = [];
	(function () {
		getCateList();
	})();
	setTimeout(function(){
		getOne();
	}, 1000);
</script>